home *** CD-ROM | disk | FTP | other *** search
- double timeArray[];
- integer hidden;
-
- ** This block outputs a constant value
- ** Copyright © 1989-1994 by Imagine That,Inc.
- ** All Rights Reserved.
- ** Extend Generic Library, Constant block; Alfy Riddle
- ** modified 3/3/92 JSL modified for V2.0
- ** 8/18/93 JSL added animation
- ** 10/15/93 JSL allowed noValues to be output
- ** 2/14/94 DJK modified trace and report
- ** 3/10/94 DJK added block label to trace & report
-
- procedure calc()
- {
- if (animationOn)
- {
- if (hidden)
- {
- animationText(1, conValue);
- animationShow(1);
- hidden = FALSE;
- }
- }
- else
- {
- if (!hidden)
- {
- animationHide(1, FALSE);
- hidden = TRUE;
- }
- }
-
- cOut = valueIn + conValue;
-
- ** sysGlobal2 is the file reference number for the DEBUG TRACE
- if( sysGlobal2 != 0.0 ) ** 0 is error, check for open file for TRACE
- {
- // template for report: |BLOCK NAME *****************|block number |BLOCK NUMBER*******
- fileWrite(sysGlobal2,"Constant block number "+(MyBlockNumber())+". Current Time:"+currentTime+".","",True);
- if(getBlockLabel(myBlockNumber()) != "")
- fileWrite(sysGlobal2,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
- fileWrite(sysGlobal2," Input = "+valueIn,"",True);
- fileWrite(sysGlobal2," Output = "+cOut,"",True);
- fileWrite(sysGlobal2," ","",True);
- }
- }
-
-
- on simulate
- {
- calc();
- }
-
-
- on createBlock
- {
- conValue = 1;
- }
-
- on dialogClose
- {
- animationHide(1, FALSE);
- hidden = TRUE;
- }
-
- on initSim
- {
- if( getPassedArray(sysGlobal0, timeArray) )
- getSimulateMsgs(FALSE);
-
- if (animationOn)
- {
- animationText(1, conValue);
- animationShow(1);
- hidden = FALSE;
- }
- else
- {
- animationHide(1, FALSE);
- hidden = TRUE;
- }
- }
-
-
- on checkdata
- {
- sysGlobal1 = 0.0; ** prevent false reports
- sysGlobal2 = 0.0; ** prevent false debugs
- }
-
-
- on endSim
- {
- ** sysGlobal1 is the file reference number for the TEXT REPORT
- if( sysGlobal1 != 0.0 ) ** 0 is error, check for open file for REPORT
- {
- // template for report: |BLOCK NAME *****************|block number |BLOCK NUMBER*******
- fileWrite(sysGlobal1,"Constant block number "+(MyBlockNumber()),"",True);
- if(getBlockLabel(myBlockNumber()) != "")
- fileWrite(sysGlobal1,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
- fileWrite(sysGlobal1," Constant = "+conValue,"",True);
- if( comments != "" )
- fileWrite(sysGlobal1," Comments = "+comments,"",True);
-
- fileWrite(sysGlobal1," ","",True);
- }
- }